package com.example.wechatlistview.tools;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * @author CVLocke 陈炜龙
 * 数组编辑类
 */
public class ArrayTools {

    public static <T> T[] mergeArray(T[] array1, T[] array2) {
        T[] result = Arrays.copyOf(array1, array1.length + array2.length);
        System.arraycopy(array2, 0, result, array1.length, array2.length);
        return result;
    }

    public static <T> T[] cutArrayFromHead(T[] array, int length) {
        T[] result = Arrays.copyOf(array, length);
        return result;
    }

    public static <T> T[] cutArrayFromPosition(T[] array, int position, int destination) {
        T[] result = Arrays.copyOfRange(array, position, destination);
        return result;
    }

}
